<?php
// +----------------------------------------------------------------------
// | 海豚PHP框架 [ DolphinPHP ]
// +----------------------------------------------------------------------
// | 版权所有 2016~2017 河源市卓锐科技有限公司 [ http://www.zrthink.com ]
// +----------------------------------------------------------------------
// | 官方网站: http://dolphinphp.com
// +----------------------------------------------------------------------
// | 开源协议 ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------

namespace app\address\validate;

use think\Validate;
/**
 * 行为验证器
 * @package app\cms\validate
 * @author 蔡伟明 <314013107@qq.com>
 */
class Index extends Validate
{
    //定义验证规则
    protected $rule = [
        'projectid|项目id' => 'require',
        'openid|用户id' => 'require',
        'province|省' => 'require',
        'city|市' => 'require',
        'district|区县' => 'require',
        'linkMan|联系人姓名' => 'require',
        'address|详细地址' => 'require',
        'mobile|联系方式' => 'require',
        'code|邮编' => 'require',
        'isDefault|是否是默认收货地址' => 'require',
        'isdel|是否删除' => 'require',
    ];

    //定义验证提示
    protected $message = [
        'projectid.require' => '请输入项目id',
        'openid.require' => '请输入用户id',
        'id.require' => '请输入地址id',
        'province.require' => '请输入省',
        'city.require' => '请输入市',
        'district.require' => '请输入区县',
        'linkMan.require' => '请输入联系人姓名',
        'address.require' => '请输入详细地址',
        'mobile.require' => '请输入联系方式',
        'code.require' => '请输入邮编',
        'isDefault.require' => '请输入默认收货地址',
        'isdel.require' => '请输入删除',
    ];

    //定义验证场景
    protected $scene = [
        //查询多条
        'select'  =>  ['projectid' => 'require','openid' => 'require'],
        //查询单条
        'query'  =>  ['projectid' => 'require','openid' => 'require','id' => 'require'],
        //新增
        'insert'  =>  [
                    'projectid' => 'require',
                    'openid' => 'require',
                    'province' => 'require',
                    'city' => 'require',
                    'district' => 'require',
                    'linkMan' => 'require',
                    'address' => 'require',
                    'mobile' => 'require'
                    ],
        //更新
        'update'  =>  ['projectid' => 'require','openid' => 'require','id' => 'require'],
        //删除
        'delete'  =>  ['projectid' => 'require','openid' => 'require','id' => 'require'],
    ];
}
